<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Key extends Model
{
    protected $table = 'keys';

    /**
     * 验证校验码并根据key字段获取某一关键信息
     * @param string $key
     * @param string $authCode
     * @return mixed
     */
    public function getRecord($key, $authCode){
        return $this->where('key','=', $key)->where('auth_code','=',$authCode)->select('key','value')->first();
    }
}
